export default {
  props: {

  },
  data() {
    return {
      input:'',
	  header:{
		  pageNumber: 1,
		  pageSize: 10
	  }
    }
  },
  created() {
  },
  methods: {
	  toDictionary(e){
		var body = {
			"dictCode": e
		}
		this.$post('/sysDictItem/queryList', {
				body
			}).then(res=>{
				this.document = res.data
			})
	  },
	  toAddress(e){
		  var body = {
		  	"dictCode": e
		  }
		  this.$post('/sysDictItem/queryList', {
		  		body
		  	}).then(res=>{
		  		this.address = res.data
		  	})
	  },
    toDoPage(url,e){
		  // 修改
		if (this.multipleSelection == '') {
			this.$message({
				message: '请选择一条需要修改的数据',
				type: 'warning'
			});
		} else if(this.multipleSelection.length>1){
			this.$message({
				message: '只能选择一条数据修改',
				type: 'warning'
			});
		} else {
			if(this.multipleSelection[0].releaseStatusEnum.id==2){
				this.$message({
					message: e+'已发布，不能修改',
					type: 'warning'
				});
			}else{
				this.$router.push({
				  path: url,
				  query: { data: JSON.stringify(this.multipleSelection) },
				});
			}
		}
    },
	//条件查询
	listS(e,url){
	  var body = {onlineReviewType:e}
	  var header = this.header
	  this.$post(url, {
			body,header
		})
		.then(res=>{
			if(res.code==0){
				console.log(res);
				this.tableData = res.data.dataList
			}
		})
	},
	// 列表
	list(e,num,url,data){
	  var body = {
		  "sortDto": [
			{
			  "orderField": "createTime",
			  "orderType": "DESC",

			}
		  ],
		  ...data
	  }
	  var header = {
		  pageNumber: num,
		  pageSize: e
	  }
	  this.$post(url, {
			body,header
		})
		.then(res=>{
			if(res.code==0){
				this.tableData = res.data.dataList
				if(url == '/PublicOpinion/statics'){
					// console.log(1111);
					this.tableData = res.data
				}
				if(url == '/PosmWeMedia/queryPosmWeMediaPage'){
					var shuju = ''
					var shuju2 = ''
					var shuju3 = ''
					var shuju4 = ''
					var shuju5 = ''
					for(var i in this.tableData){
						if(this.tableData[i].kwaiFuInformation!=null){

							this.tableData[i].kwaiFuInformation.userName = '用户名称：'+'<a href='+this.tableData[i].kwaiFuInformation.visitUrl+' style="text-decoration: none;color: #008DCB;">'+this.tableData[i].kwaiFuInformation.userName+'</a>'
							this.tableData[i].kwaiFuInformation.numberOfWorks = '作品数：'+this.tableData[i].kwaiFuInformation.numberOfWorks
							this.tableData[i].kwaiFuInformation.numberOfFans = '粉丝量：'+this.tableData[i].kwaiFuInformation.numberOfFans
							this.tableData[i].kwaiFuInformation.userId = '用户ID：'+this.tableData[i].kwaiFuInformation.userId
							shuju = this.tableData[i].kwaiFuInformation.userName+'<br>'+this.tableData[i].kwaiFuInformation.numberOfWorks+'<br>'+this.tableData[i].kwaiFuInformation.numberOfFans+'<br>'+this.tableData[i].kwaiFuInformation.userId
							this.tableData[i].kwaiFuInformation = shuju
						}else{
							this.tableData[i].kwaiFuInformation = '无'
						}
						if(this.tableData[i].microBlog!=null){
							this.tableData[i].microBlog.userName = '用户名称：'+'<a href='+this.tableData[i].microBlog.visitUrl+' style="text-decoration: none;color: #008DCB;">'+this.tableData[i].microBlog.userName+'</a>'
							this.tableData[i].microBlog.numberOfWorks = '作品数：'+this.tableData[i].microBlog.numberOfWorks
							this.tableData[i].microBlog.numberOfFans = '粉丝量：'+this.tableData[i].microBlog.numberOfFans
							this.tableData[i].microBlog.userId = '用户ID：'+this.tableData[i].microBlog.userId
							shuju2 = this.tableData[i].microBlog.userName+'<br>'+this.tableData[i].microBlog.numberOfWorks+'<br>'+this.tableData[i].microBlog.numberOfFans+'<br>'+this.tableData[i].microBlog.userId
							this.tableData[i].microBlog = shuju2
						}else{
							this.tableData[i].microBlog = '无'
						}
						if(this.tableData[i].tiktokInformation!=null){
							this.tableData[i].tiktokInformation.userName = '用户名称：'+'<a href='+this.tableData[i].tiktokInformation.visitUrl+' style="text-decoration: none;color: #008DCB;">'+this.tableData[i].tiktokInformation.userName+'</a>'
							this.tableData[i].tiktokInformation.numberOfWorks = '作品数：'+this.tableData[i].tiktokInformation.numberOfWorks
							this.tableData[i].tiktokInformation.numberOfFans = '粉丝量：'+this.tableData[i].tiktokInformation.numberOfFans
							this.tableData[i].tiktokInformation.userId = '用户ID：'+this.tableData[i].tiktokInformation.userId
							shuju3 = this.tableData[i].tiktokInformation.userName+'<br>'+this.tableData[i].tiktokInformation.numberOfWorks+'<br>'+this.tableData[i].tiktokInformation.numberOfFans+'<br>'+this.tableData[i].tiktokInformation.userId
							this.tableData[i].tiktokInformation = shuju3
						}else{
							this.tableData[i].tiktokInformation = '无'
						}
						if(this.tableData[i].volcanoVideos!=null){
							this.tableData[i].volcanoVideos.userName = '用户名称：'+'<a href='+this.tableData[i].volcanoVideos.visitUrl+' style="text-decoration: none;color: #008DCB;">'+this.tableData[i].volcanoVideos.userName+'</a>'
							this.tableData[i].volcanoVideos.numberOfWorks = '作品数：'+this.tableData[i].volcanoVideos.numberOfWorks
							this.tableData[i].volcanoVideos.numberOfFans = '粉丝量：'+this.tableData[i].volcanoVideos.numberOfFans
							this.tableData[i].volcanoVideos.userId = '用户ID：'+this.tableData[i].volcanoVideos.userId
							shuju4 = this.tableData[i].volcanoVideos.userName+'<br>'+this.tableData[i].volcanoVideos.numberOfWorks+'<br>'+this.tableData[i].volcanoVideos.numberOfFans+'<br>'+this.tableData[i].volcanoVideos.userId
							this.tableData[i].volcanoVideos = shuju4
						}else{
							this.tableData[i].volcanoVideos = '无'
						}
						if(this.tableData[i].wechatOfficialAccount!=null){
							this.tableData[i].wechatOfficialAccount.userName = '用户名称：'+'<a href='+this.tableData[i].wechatOfficialAccount.visitUrl+' style="text-decoration: none;color: #008DCB;">'+this.tableData[i].wechatOfficialAccount.userName+'</a>'
							this.tableData[i].wechatOfficialAccount.numberOfWorks = '作品数：'+this.tableData[i].wechatOfficialAccount.numberOfWorks
							this.tableData[i].wechatOfficialAccount.numberOfFans = '粉丝量：'+this.tableData[i].wechatOfficialAccount.numberOfFans
							this.tableData[i].wechatOfficialAccount.userId = '用户ID：'+this.tableData[i].wechatOfficialAccount.userId
							shuju5 = this.tableData[i].wechatOfficialAccount.userName+'<br>'+this.tableData[i].wechatOfficialAccount.numberOfWorks+'<br>'+this.tableData[i].wechatOfficialAccount.numberOfFans+'<br>'+this.tableData[i].wechatOfficialAccount.userId
							this.tableData[i].wechatOfficialAccount = shuju5
						}else{
							this.tableData[i].wechatOfficialAccount = '无'
						}
					}
				}
				this.total = parseInt(res.data.total)
			}
		})
	},
	// 分页相关
	handleSizeChange(val) {
		console.log("输入分页")
		this.list(val,1,this.url)
	},
	handleCurrentChange(val) {
		this.list(10,val,this.url)
	},
	// 条件查询
	query(url) {
	  var body = {theme:this.input}
	  var header = this.header
	  this.$post(url, {
			body,header
		})
		.then(res=>{
			if(res.code==0){
				console.log(res);
				this.tableData = res.data.dataList
				console.log(this.tableData);
				this.total = parseInt(res.data.total)
			}
		})
	},
  }
}
